<!--
 * @Author: wjc
 * @Date: 2025-10-28 17:48:38
 * @LastEditors: wjc
 * @LastEditTime: 2025-10-29 16:56:41
 * @Description: 
-->
<template>
  <el-checkbox-group @change="handleChange">
    <el-checkbox v-for="option in options" :key="field + option.value" :label="option.value">
      {{ option.label }}
    </el-checkbox>
  </el-checkbox-group>
</template>

<script setup lang="ts">
  import type { CheckboxValueType } from 'element-plus'

  defineOptions({
    name: 'MCheckbox',
  })

  withDefaults(
    defineProps<{
      field: string
      modelValue: any
      options: any[]
    }>(),
    {
      options: () => [],
    }
  )

  // const emits = defineEmits<{
  //   (e: 'update:modelValue', data: CheckboxValueType[]): void
  // }>()

  const handleChange = (val: CheckboxValueType[]) => {
    console.log('handleChange', val)
    // console.log('checkData', checkData.value)

    // emits('update:modelValue', val)
  }
</script>
